import packageJson from '../package.json';

const { name, version, config } = packageJson;

export default {
  code: name,
  version,
  width: config.width,
  height: config.height,
  coordinate: {
    x: 0,
    y: 0,
  },
  config: [
    {
      name: '通用设置',
      code: 'universal',
      children: [
        {
          name: '消息图标',
          code: 'notifIcon',
          type: 'ChangeConfig',
          value: {
            type: 0,
            iconUrl: '',
          },
          enumValue: [
            {
              key: '默认',
              value: 0,
            },
            {
              key: '自定义',
              value: 1,
              change: [
                {
                  name: '图标图片',
                  code: 'iconUrl',
                  type: 'ImgUpdate',
                },
              ],
            },
          ],
        },
        {
          name: '标记已读配置',
          code: 'markConfig',
          type: 'reqJson',
        },
      ],
    },
    {
      name: '实时消息',
      code: 'realTime',
      children: [
        {
          code: 'position',
          text: '位置',
          type: 'doubleInput',
          value: '10,50',
          min: 0,
        },
        {
          code: 'size',
          text: '尺寸',
          type: 'doubleInput',
          value: '285,102',
          min: 0,
        },
        {
          name: '预览实时消息',
          code: 'isPriview',
          value: true,
          type: 'CheckBox',
        },
        {
          name: '消息标题',
          code: 'notifTitle',
          value: {
            fontSize: 16,
            fontFamily: 'siyuan',
            color: 'rgba(255, 255, 255, 0.85)',
            fontWeight: 'normal',
          },
          type: 'FontGroup',
        },
        {
          name: '消息内容',
          code: 'notifContent',
          value: {
            fontSize: 14,
            fontFamily: 'siyuan',
            color: 'rgba(255, 255, 255, 0.65)',
            fontWeight: 'normal',
          },
          type: 'FontGroup',
        },
        {
          name: '背景颜色',
          code: 'notifBgColor',
          type: 'ColorSelector',
          value: 'rgba(70,72,234,0.5)',
        },
        {
          name: '边框颜色',
          code: 'notifBorderColor',
          type: 'ColorSelector',
          value: 'rgba(27,100,238,0.85)',
        },
        {
          name: '背景模糊',
          code: 'bgBlur',
          value: 0,
          min: 0,
          type: 'InputNumber',
          unit: 'px',
        },
        {
          name: '边框粗细',
          code: 'notifBorderSize',
          value: 1,
          min: 0,
          type: 'InputNumber',
          unit: 'px',
        },
        {
          name: '圆角设置',
          code: 'notifRadius',
          value: 5,
          min: 0,
          type: 'InputNumber',
          unit: 'px',
        },
        {
          name: '自动关闭时长',
          code: 'autoClose',
          value: 10,
          min: 5,
          max: 120,
          type: 'InputNumber',
          unit: '秒',
        },
      ],
    },
    {
      name: '消息中心',
      code: 'notifyCenter',
      children: [
        {
          code: 'position',
          text: '位置',
          type: 'doubleInput',
          value: '10,160',
          min: 0,
        },
        {
          code: 'size',
          text: '尺寸',
          type: 'doubleInput',
          value: '285,525',
          min: 0,
        },
        {
          name: '预览消息中心',
          code: 'isPriview',
          value: true,
          type: 'CheckBox',
        },
        {
          code: 'notifySpacing',
          name: '消息间距',
          type: 'InputNumber',
          value: 5,
          min: 1,
          max: 30,
          unit: 'px',
        },
        {
          code: 'maxCount',
          name: '最多展示',
          type: 'InputNumber',
          value: 100,
          min: 1,
          max: 1000,
          unit: '条',
        },
        {
          name: '背景模糊',
          code: 'bgBlur',
          value: 0,
          min: 0,
          type: 'InputNumber',
          unit: 'px',
        },
        {
          name: '背景颜色',
          code: 'notifBgColor',
          type: 'ColorSelector',
          value: 'rgba(70,72,234,0.5)',
        },
        {
          name: '默认卡片配置',
          code: 'defaultConfig',
          children: [
            {
              name: '消息标题',
              code: 'notifTitle',
              value: {
                fontSize: 16,
                fontFamily: 'siyuan',
                color: 'rgba(255, 255, 255, 0.85)',
                fontWeight: 'normal',
              },
              type: 'FontGroup',
            },
            {
              name: '消息内容',
              code: 'notifContent',
              value: {
                fontSize: 14,
                fontFamily: 'siyuan',
                color: 'rgba(255, 255, 255, 0.65)',
                fontWeight: 'normal',
              },
              type: 'FontGroup',
            },
            {
              name: '边框颜色',
              code: 'notifBorderColor',
              type: 'ColorSelector',
              value: 'rgba(27,100,238,0.85)',
            },
            {
              name: '边框粗细',
              code: 'notifBorderSize',
              value: 1,
              min: 0,
              type: 'InputNumber',
              unit: 'px',
            },
            {
              name: '圆角设置',
              code: 'notifRadius',
              value: 5,
              min: 0,
              type: 'InputNumber',
              unit: 'px',
            },
          ],
        },
        {
          name: '选中卡片配置',
          code: 'activeConfig',
          children: [
            {
              name: '背景颜色',
              code: 'notifBgColor',
              type: 'ColorSelector',
              value: 'rgba(70,72,234,0.5)',
            },
            {
              name: '边框颜色',
              code: 'notifBorderColor',
              type: 'ColorSelector',
              value: 'rgba(197,172,65,0.85)',
            },
            {
              name: '边框粗细',
              code: 'notifBorderSize',
              value: 1,
              min: 0,
              type: 'InputNumber',
              unit: 'px',
            },
          ],
        },
      ],
    },
  ],
  data: {
    field: [
      { name: 'id', mapper: 'messageId' },
      { name: 'title', mapper: 'messageTitle' },
      { name: 'content', mapper: 'messageContent' },
      { name: 'status', mapper: 'messageStatus' },
      { name: 'otherId', mapper: 'otherId', optional: true },
      { name: 'dateTime', mapper: 'dateTime', optional: true },
    ],
    type: 1,
    value: JSON.stringify([
      {
        messageId: '137',
        messageTitle: '1十四校西侧站点灯杆',
        messageContent: '[1]星悦国际校区门口任性道无人打扫长期存在卫生乱差现象,十四街十字路口经常存在违规摆摊!',
        messageStatus: 0,
        dateTime: '11-22 16:08:20',
      },
      {
        messageId: '138',
        messageTitle: '2十四校西侧站点灯杆',
        messageContent: '[2]星悦国际校区门口任性道无人打扫长期存在卫生乱差现象,十四街十字路口经常存在违规摆摊!',
        messageStatus: 0,
        dateTime: '11-22 16:08:19',
      },
      {
        messageId: '139',
        messageTitle: '3十四校西侧站点灯杆',
        messageContent: '[3]星悦国际校区门口任性道无人打扫长期存在卫生乱差现象,十四街十字路口经常存在违规摆摊!',
        messageStatus: 1,
        dateTime: '11-22 16:08:18',
      },
    ]),
  },
  events: {
    click: {
      description: '消息响应事件',
      fields: {
        id: {
          mapper: '',
          description: '消息Id',
        },
        otherId: {
          mapper: '',
          description: '其他Id',
        },
      },
    },
  },
};
